using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public partial class MapPanel : MonoBehaviour, ISIGPanel
{
    private SIGModePlayerExecutor _SIGModePlayerExecutor;
    private Player _player;
    public float _checkPointRadius;
    private bool _isActive;
    public List<Vector3> _respawnPointMapCoordinateOnScreen;
    public List<Vector3> _communicateSymbolMapCoordinateOnScreen;

    public void Show()
    {
        _isActive = true;

    }

    public void Hide()
    {
        _isActive = false;

    }

    public void ShowMessage(int messageNum)
    {
        if (_isActive)
        {
            //show message matched the num
        }
    }

    public void OnPointerDown()
    {
        if (_isActive)
        {
            if (_player._isPlayerDead)
            {
                for (int i = 0; i < _respawnPointMapCoordinateOnScreen.Count - 1; i++)
                {
                    if ((Input.mousePosition - _respawnPointMapCoordinateOnScreen[i]).magnitude <= _checkPointRadius)
                    {
                        _SIGModePlayerExecutor.Respawn(_respawnPointMapCoordinateOnScreen[i], i);
                    }
                }
            }
            else if (_player._isLanded && !_player._isTeamEscort)
            {
                for (int i = 0; i < _respawnPointMapCoordinateOnScreen.Count - 1; i++)
                {
                    if ((Input.mousePosition - _respawnPointMapCoordinateOnScreen[i]).magnitude <= _checkPointRadius)
                    {
                        _SIGModePlayerExecutor.Land(_respawnPointMapCoordinateOnScreen[i]);
                    }
                }
            }
            for (int i = 0; i < _communicateSymbolMapCoordinateOnScreen.Count - 1; i++)
            {
                if ((Input.mousePosition - _communicateSymbolMapCoordinateOnScreen[i]).magnitude <= _checkPointRadius)
                {
                    _SIGModePlayerExecutor.Communicate(i);
                }
            }
        }
    }
}
